/*
 * Copyright (c) 2009 Sylvestre Gallon <syl@pmbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#import <Foundation/NSObject.h>
#import <unistd.h>
#import <stdio.h>
#import "sdlengine.h"
#import "md2loader.h"
#import "logger.h"
#import "test.h"

int
main(int ac, char *av[])
{
	sdlengine *eng;
	md2loader *md2;
	struct scene *sc;
	test *t;
	
	t = [[test alloc] init];
	eng = [[sdlengine alloc] init];
	sc = malloc(sizeof(struct scene));

	sc->object = t;
	sc->ident = 0;
	sc->name = "test";
	[eng addscene: sc];

	md2 = [[md2loader alloc] initWithFileName: "/home/syl/tris.md2"];
	[md2 dump_info];

	if ([eng engineinit] == EXIT_FAILURE) {
		LOG(LOG_ERR, "SDL Engine failure\n");
		return EXIT_FAILURE;
	}

	if ([eng initOpenGL] == EXIT_FAILURE) {
		LOG(LOG_ERR, "OpenGL Engine failure\n");
		return EXIT_FAILURE;
	}

	[eng dojob];
	[eng release];

	return (EXIT_SUCCESS);
}
